package com.hardy.job;

import java.util.ArrayList;
import java.util.List;

/**
 * @author fuxiaohui3@nuoyuan.com.cn
 * @date 2018/11/20 10:03
 */
public class MyStack {
    private List<String> list = new ArrayList<String>();
    public synchronized void push(String value){
        synchronized(this){
            list.add(value);
            notify();
        }
    }
    public synchronized String pop() throws InterruptedException {
        synchronized (this){
            if (list.size()<=0){
                wait();
            }
            return list.remove(list.size()-1);
        }
    }

}
